{include file="public/header"}
{load href="/public/static/Content/ThemesBusiness/ListPage.css"}
<style>
    .datagrid-view {
        overflow-x: scroll;
    }
</style>
<script src="/public/static/Scripts/common-binder-list-view.js"></script>
<script src="/public/static/Scripts/ScriptsEasyui/datagrid-filter.js"></script>

<script type="text/javascript">

    var data = null;
    $(function () {
      
      $('#gridList').datagrid({
        //  url:'/admin/card/list.html?ajax=1',
         remoteSort: false,
         sortOrder: 'desc',
         //sortName: 'name',

      });
 });


    // var gridListHandler = new listGridHandler(data, 'gridListHandler', 'gridList');
    // gridListHandler.formName = '保修卡';
    // gridListHandler.enableFilter = false;
    // $(function () {
    //     gridListHandler.bindFilter($('#gridList'));
    // });
    // gridListHandler.getNewUrl = function (id) {
    //     return '/admin/card/add';
    // };
    // /* gridListHandler.getEditUrl = function(recordID) {
    //      return '/admin/usergroup/edit/' + recordID;
    //  };*/

    // gridListHandler.getDeleteUrl = function (recordID) {
    //     return '/admin/card/del/' + recordID;

    // };
    function formatState(val, row, index) {
        if (row.status == 0) {
            val = '<span style="display:inline-block;background-color:#abbac3;color:#fff;padding:1px 5px;">' +
                '正常' +
                '</span>';
        }
        else {
            val = '<span style="display:inline-block;background-color:#d15b47;color:#fff;padding:1px 5px;">' +
                '停用' +
                '</span>';
        }
        return val;
    }

    function formatAction(val, row, index) {
        val = '{eq name="power.activate" value="true"} <a href="javascript:;" onclick="yanqi(' + row.id + ')" title="延期">延期</a>{/eq}';

        val += '{eq name="power.edit" value="true"} <a href="javascript:;" onclick="edit(' + row.id + ')" title="编辑">编辑</a>{/eq}';
        return val;
    }

    function Search() {
        var str = "";

        if ($("#Search").val() != "") {
            str += $("#Search").val();
        }

        $('#gridList').datagrid('load', {
            tj: $("#GroupID").combo('getValue'),
            search: $("#Search").val(),
        });
    }


    function yanqi(id) {
        window.showBusinessForm("延期", '/admin/card/yanqi.html?id=' + id);
    }

    function edit(id) {
        window.showBusinessForm("编辑", '/admin/card/edit_card.html?id=' + id);
    }

    function daochu() {
        var stime = $('#stime').datebox('getValue');
        var etime = $('#etime').datebox('getValue');
        if (stime != "" && etime == "") {
            $.messager.alert('提示', '请先输入结束时间', 'error');
            return false;
        }
        if (etime != '' && stime == '') {
            $.messager.alert('提示', '请先输入起始时间', 'error');
            return false;
        }

        location.href = "daochu.html?stime=" + stime + "&etime=" + etime;
    }

    //查看详情
    function bxztAction(val, row, index) {

        val = '<a href="#" onclick="show_bxk(' + row.id + ')" title="保修卡" style="color:#1024EE;">查看详情（保修卡）</a>';
        return val;


    }


    var width = $(window).width() * 0.6;
    var height = $(window).height() * 1.05;

    //查看保修卡
    function show_bxk(id) {

        window.showBusinessForm("保修卡", '/admin/card/see.html?id=' + id, width, height);


    }


</script>



<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',border:false" class="grid-toolbar-panel" id="gridList_ToolBar">
        <a href="#" id="news" class="easyui-linkbutton grid-toolbar-button"></a>
        <span style="padding-left:50px;">按条件查询：
            <select class="easyui-combobox" name="state" id="GroupID" data-options="required:true,tipPosition:'right',"
                style="width:152px;">
                <option value="0">按商品序列号</option>
                <option value='1'>按商品名称</option>
            </select>
            <input type="text" id="Search" />
            <a href="#" style="padding-left:10px;" onclick="Search()">查询</a>
            &nbsp;&nbsp;
            起始时间：<input id="stime" type="text" class="easyui-datebox" style="width:100px;" value="">-
            结束时间：<input id="etime" type="text" class="easyui-datebox" style="width:100px;" value="">
            {eq name="power.export" value="true"}
            <a href="#" style="padding-left:10px;" onclick="daochu()">导出数据</a>
            {/eq}
        </span>

    </div>
    <div data-options="region:'center',border:false">
        <table id="gridList" exusagetype="MultiSelection"
            data-options="pagination:true,pageSize:15,pageList:[10,15,20],striped:true,fit:true,fitColumns:true,rownumbers:true,idField:'id',singleSelect: true"
            url="/admin/card/list.html?ajax=1">
            <thead data-options="frozen:true">
                <tr>
                    <th data-options="field:'bxzt',halign:'center',align:'left',width:150,formatter:bxztAction,sortable:true"><span
                            class="grid-header-sortable">保修状态</span></th>
                    <th data-options="field:'status',halign:'center',align:'left',width:50,sortable:true"><span
                            class="grid-header-sortable">状态</span></th>
                    <th data-options="field:'baoxiutime',halign:'center',align:'left',width:300,sortable:true"><span
                            class="grid-header-sortable">保修期限</span></th>
                    <th data-options="field:'id',width:80,halign:'center',align:'center',formatter:formatAction">操作
                    </th>
                    <th data-options="field:'goodstags_sn',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">序列号</span></th>
                    <th data-options="field:'attr_sn',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">关联序列号</span></th>
                    <th data-options="field:'good_name',halign:'center',align:'left',width:200,sortable:true"><span
                            class="grid-header-sortable">商品名称</span></th>

                    <th data-options="field:'good_model',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">产品型号</span></th>
                    <th data-options="field:'bianhao',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">保修卡编号</span></th>
                    <th data-options="field:'danwei',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">单位</span></th>
                    <th data-options="field:'user',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">联系人</span></th>
                    <th data-options="field:'phone',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">电话</span></th>
                    <th data-options="field:'mobile_phone',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">手机</span></th>
                    <th data-options="field:'email',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">电子邮件</span></th>
                    <th data-options="field:'adduser',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">添加人</span></th>
                    <th data-options="field:'addtime',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">添加时间</span></th>
                    <th data-options="field:'checkuser',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">审核人</span></th>
                    <th data-options="field:'checktime',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">审核时间</span></th>

                </tr>
            </thead>

        </table>

    </div>
</div>
{include file="public/footer"/}